package com.manage.project.biz.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.manage.framework.aspectj.lang.annotation.Log;
import com.manage.framework.aspectj.lang.enums.BusinessType;
import com.manage.project.biz.domain.BizTujianjiegoudingqijiancha;
import com.manage.project.biz.service.IBizTujianjiegoudingqijianchaService;
import com.manage.framework.web.controller.BaseController;
import com.manage.framework.web.domain.AjaxResult;
import com.manage.common.utils.poi.ExcelUtil;
import com.manage.framework.web.page.TableDataInfo;

/**
 Controller
 *
 * @author liutao
 *
 */
@RestController
@RequestMapping("/biz/tujianjiegoudingqijiancha")
public class BizTujianjiegoudingqijianchaController extends BaseController
{
    @Autowired
    private IBizTujianjiegoudingqijianchaService bizTujianjiegoudingqijianchaService;

    /**
     * 查询定期检查列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjiegoudingqijiancha:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizTujianjiegoudingqijiancha bizTujianjiegoudingqijiancha)
    {
        startPage();
        List<BizTujianjiegoudingqijiancha> list = bizTujianjiegoudingqijianchaService.selectBizTujianjiegoudingqijianchaList(bizTujianjiegoudingqijiancha);
        return getDataTable(list);
    }

    /**
     * 导出定期检查列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjiegoudingqijiancha:export')")
    @Log(title = "定期检查", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BizTujianjiegoudingqijiancha bizTujianjiegoudingqijiancha)
    {
        List<BizTujianjiegoudingqijiancha> list = bizTujianjiegoudingqijianchaService.selectBizTujianjiegoudingqijianchaList(bizTujianjiegoudingqijiancha);
        ExcelUtil<BizTujianjiegoudingqijiancha> util = new ExcelUtil<BizTujianjiegoudingqijiancha>(BizTujianjiegoudingqijiancha.class);
        return util.exportExcel(list, "定期检查数据");
    }

    /**
     * 获取定期检查详细信息
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjiegoudingqijiancha:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bizTujianjiegoudingqijianchaService.selectBizTujianjiegoudingqijianchaById(id));
    }

    /**
     * 新增定期检查
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjiegoudingqijiancha:add')")
    @Log(title = "定期检查", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizTujianjiegoudingqijiancha bizTujianjiegoudingqijiancha)
    {

        return toAjax(bizTujianjiegoudingqijianchaService.insertBizTujianjiegoudingqijiancha(bizTujianjiegoudingqijiancha));
    }

    /**
     * 修改定期检查
     */
    @Log(title = "定期检查", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizTujianjiegoudingqijiancha bizTujianjiegoudingqijiancha)
    {
        return toAjax(bizTujianjiegoudingqijianchaService.updateBizTujianjiegoudingqijiancha(bizTujianjiegoudingqijiancha));
    }

    /**
     * 删除定期检查
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjiegoudingqijiancha:remove')")
    @Log(title = "定期检查", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bizTujianjiegoudingqijianchaService.deleteBizTujianjiegoudingqijianchaByIds(ids));
    }
}
